﻿var SearchResultsInfo = function(container) {
    var self = this;

    var Elements = {
        resultsText: container.find('.cc-search-results-txt'),
        noResultsExtra: container.find('.cc-no-search-results-extra'),
        infoTitle: container.find('.no-results-title'),
        searchText1: container.find('.no-results-text1'),
        searchText2: container.find('.no-results-text2'),
        searchText3: container.find('.no-results-text3')
    };

    var initialize = function() {
        Elements.infoTitle.html(translate('SearchResults_NoResults_Title'));
        Elements.searchText1.html(translate('SearchResults_NoResults_Text1'));
        Elements.searchText2.html(translate('SearchResults_NoResults_Text2'));
        Elements.searchText3.html(translate('SearchResults_NoResults_Text3'));
    };

    this.show = function(searchText, results) {
        if (!results)
            showNoResultsInfo(searchText);
        else showResultsInfo(searchText, results);
    };

    var showNoResultsInfo = function(searchText) {
        var html = translate('SearchResults_Search') + " ";
        if (searchText && searchText.length > 0)
            html += '"' + searchText + '" ';
        html += translate('SearchResults_NoResults');
        Elements.resultsText.html(html);
        Elements.noResultsExtra.show();
        container.show();
    };

    var showResultsInfo = function(searchText, results) {
        var html = translate('SearchResults_Search') + " ";
        if (searchText && searchText.length > 0)
            html += '"' + searchText + '" ';
        html += translate('SearchResults_Generated') + ' <span class="cc-days">' + results + '</span> ';
        if (results == 1)
            html += translate('SearchResults_Rezultat') + ".";
        else html += translate('SearchResults_Rezultate') + ".";
        Elements.resultsText.html(html);
        Elements.noResultsExtra.hide();
        container.show();
    };

    this.hide = function() {
        container.hide();
    };

    initialize();
};